package ar.com.cooker.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
 * Objeto BO Critica de Receta.
 * @author c02536
 *
 */
@Entity
@Table(name = "ck_Review")
public class Review implements Serializable{

	private static final long serialVersionUID = -188732978436623555L;

	@Id
	@GeneratedValue
	@Column(name = "id_review")
	private Integer id;
	
	@Column(length = 50)
	private String ranking;
	
	@Column(length = 200)
	private String commnents;
	
	@ManyToOne(targetEntity = User.class, fetch = FetchType.EAGER)
	@JoinColumn(name = "id_user_fk", referencedColumnName = "id_user",nullable = false)
	private User user;
	
	@ManyToOne(targetEntity = Recipe.class, fetch = FetchType.LAZY)
	@JoinColumn(name = "id_recipe_fk", referencedColumnName = "id_recipe", nullable = false)
	private Recipe recipe;

	public Review() {
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getRanking() {
		return ranking;
	}

	public void setRanking(String ranking) {
		this.ranking = ranking;
	}

	public String getCommnents() {
		return commnents;
	}

	public void setCommnents(String commnents) {
		this.commnents = commnents;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Recipe getRecipe() {
		return recipe;
	}

	public void setRecipe(Recipe recipe) {
		this.recipe = recipe;
	}
}
